package com.mmloo.common.exception;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by jessy on 2015/9/24.
 */
@ControllerAdvice
public class MyExceptionHandler {
    @ExceptionHandler(Exception.class)
    public String handleException(Exception e,HttpServletRequest request){
        System.out.println("error >>>>>>>>>>>>>>>>>>>>>>>>>>>>> " + e.getMessage());
        request.setAttribute("message",e.getMessage());
        return "error/myException";
    }
}
